<template>
  <antd-form
    v-model="formData"
    ref="AntdForm"
    :options="formOption"
    :col-span="24"
    :immediate="false"
    :formButtons="null"
    style="padding: 24px"
  />
</template>

<script>
import AntdForm from '../antd-form';
import axios from '../../plugins/axios.js';
import { handleFormRes } from '../../utils/resolver.js';

export default {
  name: 'reset-password-form',
  components: { AntdForm },
  data() {
    return {
      formData: {},
      formOption: [
        {
          component: 'a-input',
          field: 'old_pwd',
          rules: { required: true, message: '请输入旧密码' },
          label: '旧密码',
          value: '',
          props: { type: 'password', placeholder: '请输入旧密码' },
        },
        {
          component: 'a-input',
          field: 'new_pwd',
          rules: { required: true, message: '请输入新密码' },
          label: '新密码',
          value: '',
          props: { type: 'password', placeholder: '请输入新密码' },
        },
      ],
    };
  },
  methods: {
    async onOk() {
      return await handleFormRes(
        (params) => axios.put('/xw-microservice/xw-system/v3/user/updateSecondaryPassword', params),
        this.formData
      );
    },
  },
};
</script>

<style></style>
